/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$('body').ready(function(){
    //alert("ssss");
    $.fn.all_news_paging = function(){
        //alert("ssss");
        $('.pagination_content').find('a').each(function(){
            //console.log("aaa");
            //alert("sssss");
            $(this).click(function(){
                //console.log("aaa");
                var url = $(this).attr('href');
                var st = 0;
                values = url.split("&");
                if(values[1] != null){
                temps = values[1].split("=");
                st = temps[1];
            }
            window.location.href=$("#global_url").attr("value") + "/danh-sach-san-pham/" + st+".html" ;
            //window.location.href=$("#global_url").attr("value") + "/"+$("#page_url").attr("value")+".html/" + st;
            return false;
            })
        });
    } 
    
    
    
    $.fn.validatePayment=function()
    {
        //alert($("#global_url").attr("value"));
        var regValidator = $('#payment').bValidator(vnOptions);
        $("#payment").submit(function(data){
            if(regValidator.isValid()){
                $url=$("#global_url").attr("value") + "/index.php?act=news&CODE=payment";
                $.post(
                    $url, 
                    $("#payment").serialize(), 
                    function(data){
                        $data = $.trim(data);
                        if ($data =="1") {
                            alert(check_out_message);
                            window.location.href=$("#global_url").attr("value");
                        }

                    }, 
                    'html'
                );
            }
        });
    }
    
});


